import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { FormDefaultComponent } from './FormDefault.component';

@Component({
    selector: 'app-form-input-checkbox',
    templateUrl: './FormInputCheckbox.component.html',
})
export class FormInputCheckboxComponent extends FormDefaultComponent implements OnInit {
    @Output() inputChange = new EventEmitter<any>();

    constructor() {
        super();
    }

    ngOnInit() {
        super.ngOnInit();
        const { formGroupReference, formControlId } = this.configuration;
        formGroupReference.get(formControlId).valueChanges.subscribe((selected) => this.inputChange.emit(selected));
    }
}
